<template>
	<view>
		<scroll-view style="height: 1350rpx;width: 750rpx;box-sizing: border-box;" scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered"
			:refresher-threshold="0" refresher-background="#EE7B30" @refresherpulling="onPulling" @refresherrefresh="onRefresh" :scroll-top="scrollTop"  @scrolltolower="scrolltolower">
			<view class="kecheng" style="display: flex;flex-wrap: wrap;margin: 20rpx 0 0 20rpx;width: 730rpx;">
				<view class="jigouke_jing" v-for="(itme,index) in jigou_ke" :key="index" @tap="gokechengxiang(itme)" style="margin:0 10rpx 10rpx 0;position: relative;background: #FFFFFF;box-sizing: border-box;padding: 0rpx 0rpx  35rpx 0rpx;border-radius: 15rpx;border: #C1C1C1 0.09rpx solid;">
					<view style="position: absolute;top: -1;left: -1;z-index: 12121;min-width: 70.7rpx;height: 35rpx;text-align: center;line-height: 35rpx;color: #FFFFFF;font-size: 20rpx;border-radius: 15rpx 0 15rpx 0 ;background: #FF3D3D;padding: 0 6rpx;">{{itme.label}}</view>
					<image :src="itme.face_url" mode="" style="width: 350rpx;height: 270rpx;border-radius: 15rpx;vertical-align: middle;margin: 0"></image>
					<view style="position: absolute;top: 178rpx;" v-if="itme.is_attend_activities">  
						<image src="../../../static/newshouye/quan.png" style="width:350rpx;vertical-align: bottom;" mode="widthFix"></image>
					</view>
					
					<view style="font-size:28.146rpx;color: #292929;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;width: 270rpx;margin-top: 5rpx;">
						<text style="font-weight: bold;">【{{itme.course_num}}节】</text>
						<text>{{itme.title}}</text>
					</view>
					<view style="display: flex;justify-content: space-between;align-items: center;height: 37rpx;margin-left: 10rpx;">
						<view style="display: flex;align-items: center;position: relative;">
							<view style="color: #FF3D3D;font-weight:bold ;" v-if="itme.map.activityEntity != null" >
								<text style="font-size:20rpx;">￥</text>
								<text style="font-size:30rpx;margin: 0 5rpx;">{{itme.map.activityEntity.price}}</text>
								<text style="font-size:20rpx;">/ 节</text>
							</view>
							<view style="font-weight:bold ;height: 37rpx;" v-if="itme.map.priceList.length != 0" :class="itme.map.activityEntity != null ? 'panduan' :'zhengchang'">
								<text style="font-size:20rpx;">￥</text>
								<text style="margin: 0 5rpx;">{{itme.map.priceList[0].price}}</text>
								<text style="font-size:20rpx;">/ 节</text>
							</view>
						</view>
					</view>
					<view style="font-size:26rpx;color: #C1C1C1;height: 26rpx;position: relative;top: 10rpx;left: 10rpx;">{{itme.pay_num}}人已购买</view>
				</view>
			</view>
			<view style="height: 100rpx;width: 100%;margin: 30rpx 0;font-size: 25rpx;border-top: 2rpx solid #BEBEBE;text-align: center;line-height: 100rpx;" v-if="isshow">
				暂无数据
			</view>
		</scroll-view>
	</view>
</template>
<script>
	export default {
		data(){
			return {
				jigou_ke: [],
				num: 1,
				triggered: false,
				biao_num: 1,
				shua: 1,
				quan: {},
				isshow: false,
				id: ""
			}
		},
		methods:{
		async	xin(){
			    let _this = this
				uni.showLoading({
					title:"加载中"
				})
				const res = await _this.$myRequest({
					url:"/masterSetPrice/queryCommodityList",
					method:"get",
					data:{
						status:2,
						mechanism_id:this.id,
						type:"mechanism_offline",
						pageSize:10,
						currentPage:this.num
					}
				})
				if(res.data.list.length < 10){
					_this.biao_num = 2
				}else{
					_this.biao_num = 1
				}
				if(_this.jigou_ke.length == 0){
					_this.jigou_ke = res.data.list
				}else{
					_this.jigou_ke = _this.jigou_ke.concat(res.data.list)
				}
				_this.triggered = false
				uni.hideLoading()
			},
			gokechengxiang(itme){
				uni.navigateTo({
				    url: '/pages/World/classChannel/classChannel?curriculumId=' + itme.id
				})
			},
			onRefresh(){
				this.isshow = false
				this.num = 1
				this.triggered = true
				this.jigou_ke = []
				this.xin()
			},
			scrolltolower(){
				if(this.biao_num == 1){
					this.num++
					this.xin()
				}else{
					this.isshow = true
					uni.showToast({
						title: "加载完毕",
						duration: 2000,
						icon: "none"
					})
				}
			}
		},
		onLoad(option) {
			this.id = option.id 
			this.xin()
		},
		onShow() {
			
		}
	}
</script>
<style lang="scss" scoped>
	.panduan{
		color: #BFBFBF;
		text-decoration:line-through ;
		margin-left: 10rpx;
		font-size: 25rpx;
		margin-top: 15rpx;
	}
	.zhengchang{
		color:#FF3D3D;
		font-size: 30rpx;
	}
</style>